import React, { useState } from 'react';
// 表格组件和 ts类型声明
import { Table } from 'antd';
import type { ColumnsType } from 'antd/es/table';
// 分页
import { Pagination, ConfigProvider } from 'antd';
// 导入中文
import zh_CN from 'antd/es/locale/zh_CN';
interface Props {
    columns: ColumnsType<DataType>,
    lossList: Array<DataType>,
    rowSelection?: any
    pagination?: any
    onChange?: any
}
// 表格声明
interface DataType {
    key: string;
    id: number;
    create_people: string,
    create_name: string;
    sun_type: string;
    sun_time: string;
    shen_people: string;
    shen_time: string;
    sun_reason: string;
    status: string;
}
// // 分页状态
// let [pagination,setPagination] = useState({current:1,pageSize:10,total:100,showTitle:true,})
// // 分页回调
function Tables(props: Props) {
    // let onhandelChange = function(pagination:any){
    //     // setPagination(pagination)
    //     console.log(pagination);
    //     let {current, pageSize} = pagination
    // }
    return (
        <div>
            <ConfigProvider locale={zh_CN}>
                <Table
                    // 表头
                    columns={props.columns}
                    // 行内容
                    dataSource={props.lossList}
                    // 复选框
                    rowSelection={props.rowSelection}
                    // 分页
                    pagination={props.pagination}
                    // 分页触发回调
                    onChange={props.onChange}
                    // 每行添加key属性
                    rowKey={record => record.key}
                />
            </ConfigProvider>
        </div>
    );
}